<?php
namespace App\Http\Controllers\Common;

use App\Http\Controllers\Backend\BaseController;
use App\Http\Controllers\Service\Api\common\CommonService;
use Illuminate\Http\Request;

class CommonController extends BaseController
{
    /**
     * @desc 上传图片到七牛云
     * @param Request $request
     * @return mixed
     */
    public function uploadImage(){
        [$bool, $ex] = CommonService::uploadImage();
        return $bool ? ApiHelper::responseSuccess($ex) : ApiHelper::responseError([], $ex);
    }

    /**
     * @desc 上传视频到七牛云
     * @param Request $request
     * @return mixed
     */
    public function uploadVideo(){
        [$bool, $ex] = CommonService::uploadVideo();
        return $bool ? ApiHelper::responseSuccess($ex) : ApiHelper::responseError([], $ex);
    }

    /**
     * @desc 上传其他对象化到七牛云
     * @param Request $request
     * @return mixed
     */
    public function uploadMaterial(){
        [$bool, $ex] = CommonService::uploadMaterial();
        return $bool ? ApiHelper::responseSuccess($ex) : ApiHelper::responseError([], $ex);
    }

}
